package com.cf.r944_ak;

import java.io.*;
import java.util.HashSet;
import java.util.Set;

public class c {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);
        in.nextToken(); int t = (int) in.nval;
        while (t-- > 0) {
            in.nextToken(); int a = (int) in.nval - 1;
            in.nextToken(); int b = (int) in.nval - 1;
            in.nextToken(); int c = (int) in.nval - 1;
            in.nextToken(); int d = (int) in.nval - 1;
            if (a == c || a == d || b == c || b == d) {
                out.println("YES");
                continue;
            }
            Set<Integer> seta = new HashSet<>();
            Set<Integer> setb = new HashSet<>();
            int i = (a + 1) % 12;
            for (; i != b; i = (i + 1) % 12) {
                seta.add(i);
            }
            i = (i + 1) % 12;
            for (; i != a; i = (i + 1) % 12) {
                setb.add(i);
            }
            if ((seta.contains(c) && setb.contains(d)) || (seta.contains(d) && setb.contains(c))) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }
        out.flush();
        out.close();
        br.close();
    }

}
